﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReactiveLang.Collections
{
    partial class EnumerableExpression
    {
        internal class Subject<T> : SubjectBase<IEnumerableExpressionObserver<T>>, IEnumerableExpression<T>, IEnumerableExpressionObserver<T>
        {
            public void OnAdded(IExpression<T> item, int index)
            {
                ForEach(o => o.OnAdded(item, index));
            }

            public void OnRemoved(IExpression<T> item, int index)
            {
                ForEach(o => o.OnRemoved(item, index));
            }

            public void OnValue(IEnumerable<IExpression<T>> value)
            {
                ForEach(o => o.OnValue(value));
            }

            public void OnException(Exception ex)
            {
                ForEach(o => o.OnException(ex));
            }
        }
    }
}